Re: [DNG] [OT] Flash memory testing on Windows (was: fdisk SD card partitioning question)

2022-06-14 Thread ael via Dng
On Mon, Jun 13, 2022 at 07:31:59PM -0700, Syeed Ali wrote:
> As there was some discussion of fakes.  At your own risk and if you
> have access to Windows there are some good tools to low-level verify
> either for a fake or bad bits on USB/SD storage:

But we have already noted that f3 is such a tool for linux...

ael

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] libudev-compat documentation (Was: Remarks on vdev, Eudev, Mdev)

2022-06-14 Thread aitor

Hi,

On 11/6/22 14:07, aitor wrote:


I started documenting libudev-compat in my website as part of the documentation 
about vdev:
https://www.gnuinos.org/libudev-compat/  

This documentation is a work in progress.


Jude Nelson was wondering whether or not is possible to use `sendfile(2)`:

   *ssize_t sendfile(int */out_fd/*, int */in_fd/*, off_t **/offset/*, size_t 
*/count/*); *

in the function:

   static int udev_monitor_fs_push_event( int fd, struct udev_monitor* monitor 
);

of the file:

https://github.com/jcnelson/vdev/blob/master/libudev-compat/libudev-fs.c  


If you read his comment between the lines 759-771:


   // send the contents of a file containing a serialized packet to the libudev 
client:
   // * read the contents
   // * send it along to the receiving struct udev_monitor
   // NOTE: The file format is expected to be the same as a uevent packet:
   //   * all newlines (\n) will be converted to null (\0), since that's how
   // the kernel sends it.
   //   * the buffer is expected to be at most 8192 bytes long.
   // return 0 on success
   // return -errno on failure
   // return -EMSGSIZE if the file is too big
   // return -EBADMSG if the file is invalid
   // return -EAGAIN if we'd block on send
   // TODO: can we use sendfile(2)?


The use of `sendfile` would imply to convert the function below (used by 
`udev_monitor_fs_push_event`):

   // send udev_device along
   // TODO: sendfile(2)?
   rc = udev_monitor_send_device( monitor, NULL, dev );
   if( rc < 0 ) {

  log_error("udev_monitor_send_device rc = %d", rc );

   }

   else {

  rc = 0;

   }

into something like this:

   off_t offset = 0;
   
   // send file descriptor

   rc = sendfile( monitor->sock_fs, fd, &offset, BUFSIZ );
   if( rc < 0 ) {
  
  rc = -errno;

  log_error("udev_monitor_send_device rc = %d", rc );
   }
   else {
  
  rc = 0;

   }

Other modifications would be required in the receiver side, of course.

According to the description in the Linux Man Page:

https://man7.org/linux/man-pages/man2/sendfile.2.html  


*sendfile*() copies data between one file descriptor and another.
Because this copying is done within the kernel,*sendfile*() is
more efficient than the combination ofread(2)  
  andwrite(2)  
,
which would require transferring data to and from user space.

Well, I've been trying to make such improvement in libudev-compat, and 
appearently it's working fine.
So, I'll update my git repository soon.

... And again: if you catch some inaccuracy or glaring error in my 
documentation,
please let me know and I'll update it.

Thanks in advance,

Aitor.


___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] libudev-compat documentation (Was: Remarks on vdev, Eudev, Mdev)

2022-06-14 Thread aitor

On 14/6/22 13:39, aitor wrote:

// send file descriptor
    rc = sendfile( monitor->sock_fs, fd, &offset, BUFSIZ );
    if( rc < 0 ) {
   
   rc = -errno;

   log_error("udev_monitor_send_device rc = %d", rc );
    }
    else {


log_error("sendfile(): rc = %d", rc );

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] fdisk SD card partitioning question

2022-06-14 Thread Jim Jackson



On Mon, 13 Jun 2022, Andreas Messer wrote:

> > Created a new partition 1 of type 'Linux' and of size 27.5 GiB.
> 
> You shouldn't do that. Although its possible to "partition" SD-Cards,
> this is not recommended. This is since SD-Cards have some kind of
> knowledge about "how FATFS works" to optimize the write cycles. This 
> won't work if the card is partitioned. 

Bit wierd that X-gazillion Raspberry Pi's out there are expected to work 
with partitioned SD cards.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


Re: [DNG] fdisk SD card partitioning question

2022-06-14 Thread d...@d404.nl

On 14-06-2022 22:43, Jim Jackson wrote:



On Mon, 13 Jun 2022, Andreas Messer wrote:


Created a new partition 1 of type 'Linux' and of size 27.5 GiB.

You shouldn't do that. Although its possible to "partition" SD-Cards,
this is not recommended. This is since SD-Cards have some kind of
knowledge about "how FATFS works" to optimize the write cycles. This
won't work if the card is partitioned.

Bit wierd that X-gazillion Raspberry Pi's out there are expected to work
with partitioned SD cards.

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng


There is a reason that SD-Cards wear out quickly with a Raspberry Pi. 
But the Pi need to boot from a FAT partition and at the same time 
Raspbian will not run on a FAT partition. Luckily you can boot them from 
the network and from USB pen drive or SSD too.


Grtz

Nick

___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng