On Sun, 29 Feb 2004, Szakacsits Szabolcs wrote:
> In more verbose, what could be beneficial for everybody is
>
> 1) making the unnamed -> named conversion
> AND
> 2) encapsulating the details in macros or inline functions
>
> Let's see an example:
>
> now: a->data_size = cpu_to_le32(le32_to_cpu(a->data_size) + 2);
> you want: a->n.data_size = cpu_to_le32(le32_to_cpu(a->n.data_size + 2);
No, you don't. (-; I am only willing to accept naming the structs and
unions if and only if it is done in _exactly_ the same way as the kernel
NTFS driver. Otherwise it would be far too confusing for anyone working
on both or copying code from one to the other.
> could be: ntfs_attr_datasize_set(a, ntfs_attr_datasize_get(a) + 2);
>
> The last one might be even more simple if it made sense in the future,
>
> ntfs_attr_datasize_add(a, 2);
>
> This has the following advantages:
>
> - better portability
> - more readable
> - more reliable code (endianness can't be forgotten)
> - with well chosen names, much less to type/read/print
Yes but potential for using the wrong one is huge, like accidentally
using ntfs_attr_size_set() instead of ntfs_attr_datasize_set() or
whatever...
Also the header files would become quite huge as all such functions must
be inlined otherwise the speed impact would be unnacceptable.
> Would you be willing to do both conversations, not only the unnamed one?
I would be very happy to take patches for the unnamed conversion as long
as it is done like in the kernel.
The other conversion is something I am not very happy about. It is far
too much abstraction and code obfuscation for my tastes... So I strongly
suggest to do them completely separately, especially as it is very likely
that a flame fest will happen about what to call the abstracted functions
once such a patch appears...
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
|