Re: fs/bio.c - Hardcoded sector size ?



On Fri, Sep 29, 2006 at 01:32:05PM -0700, Randy Dunlap wrote:
How about adding kerneldoc for sector_t itself?

Good idea, but afaik it would have to be added for the entire
struct, not just one field.

sector_t 's a simple typedef from unsigned long or u64 depending on
config rather than a struct - will kerneldoc still pick up the comments
on theese?

Assuming it will I suggest the following. I've kept my shorter text in
the bi_sector field as it is now more fully explained with sector_t.


Signed-Off-By: Roger Gammans <rgammans@xxxxxxxxxxxxxxxxxxxxxx>

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 76bdaea..77a8e6b 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -70,7 +70,8 @@ typedef void (bio_destructor_t) (struct
* stacking drivers)
*/
struct bio {
- sector_t bi_sector;
+ sector_t bi_sector; /* device address in 512 byte
+ sectors */
struct bio *bi_next; /* request queue link */
struct block_device *bi_bdev;
unsigned long bi_flags; /* status, command, etc
*/
diff --git a/include/linux/types.h b/include/linux/types.h
index 3f23566..0ddfa1a 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -127,8 +127,12 @@ #endif
/* this is a special 64bit data type that is 8-byte aligned */
#define aligned_u64 unsigned long long __attribute__((aligned(8)))

-/*
+/**
* The type used for indexing onto a disc or disc partition.
+ *
+ * Linux always considers sectors to be 512 bytes long independently
+ * of the devices real block size.
+ *
* If required, asm/types.h can override it and define
* HAVE_SECTOR_T
*/


--
Roger. Home| http://www.sandman.uklinux.net/
Master of Peng Shui. (Ancient oriental art of Penguin Arranging)
Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/
So what are the eigenvalues and eigenvectors of 'The Matrix'? --anon

Attachment: signature.asc
Description: Digital signature



Relevant Pages

  • Re: Process dump facility public API - pdpublic.h
    ... struct _PDOPTIONS *pSystemDefaults; /* Ptr to System Defaults struct */ ... typedef DDPREQUEST *PDDREQUEST; ... also be specified in the DDPREQUEST flags. ... /* PDUNION is used in both the PDPROCESS and PDPROCESS2 structures. ...
    (comp.os.os2.bugs)
  • Re: advantage of using typedefs
    ... The underlying problem / solution here is "abstraction". ... struct, ... possible to call this with a length or pressure measurement by ... typedef double temperature; ...
    (comp.lang.c)
  • Re: syntax errror
    ... >>> int maxGrey' ... >> declaration of maxGrey. ... typedef double; ... struct some_tag_name { ...
    (comp.lang.c)
  • Re: question about struct??
    ... It is not the "typedef" keyword that defines the type. ... is the "struct {" pair that does it: ... struct S {int a; int b;}; ...
    (comp.lang.c)
  • Re: structs help
    ... >same name and the second compiler didn't like it. ... As I like to point out, the real problem with typedef is that it ... This is even more pronounced in the "typedef struct ..." ... time, though, I expect any programmer working on the zorgle program ...
    (comp.lang.c)