1size(9P) Kernel Properties for Drivers size(9P)
2
3
4
6 size, Nblock, blksize, device-nblocks, device-blksize - device size
7 properties
8
10 A driver can communicate size information to the system by the values
11 associated with following properties. Size information falls into two
12 categories: device size associated with a dev_info_t node, and minor
13 node size associated with a ddi_create_minor_node(9F) dev_t (parti‐
14 tion).
15
16
17 device size property names:
18
19 device-nblocks An int64_t property representing device size in
20 device-blksizeblocks.
21
22
23 device-blksize An integer property representing the size in bytes of
24 a block. If defined, the value must be a power of
25 two. If not defined, DEV_BSIZE is implied.
26
27
28
29 minor size property names:
30
31 Size An int64_t property representing the size in bytes of a
32 character minor device (S_IFCHR spec_type in ddi_cre‐
33 ate_minor_node).
34
35
36 Nblocks An int64_t property representing the number blocks, in
37 device-blksize units, of a block minor device (S_IFBLK
38 spec_type in ddi_create_minor_node).
39
40
41 blksize An integer property representing the size in bytes of a
42 block. If defined, the value must be a power of two. If not
43 defined, DEV_BSIZE is implied.
44
45
46
47 A driver that implements both block and character minor device nodes
48 should support both "Size" and "Nblocks". Typically, the following is
49 true: Size = Nblocks * blksize.
50
51
52 A driver where all ddi_create_minor_node(9F) calls for a given instance
53 are associated with the same physical block device should implement
54 "device-nblocks". If the device has a fixed block size with a value
55 other than DEV_BSIZE then "device-blksize" should be implemented.
56
57
58 The driver is responsible for ensuring that property values are updated
59 when device, media, or partition sizes change. For each represented
60 item, if its size is know to be zero, the property value should be
61 zero. If its size is unknown, the property should not be defined.
62
63
64 A driver may choose to implement size properties within its prop_op(9E)
65 implementation. This reduces system memory since no space is used to
66 store the properties.
67
68
69 The DDI property interfaces deal in signed numbers. All Size(9P) values
70 should be considered unsigned. It is the responsibility of the code
71 dealing with the property value to ensure that an unsigned interpreta‐
72 tion occurs.
73
75 See attributes(5) for descriptions of the following attributes:
76
77
78
79
80 ┌─────────────────────────────┬─────────────────────────────┐
81 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │Interface Stability │Committed │
84 └─────────────────────────────┴─────────────────────────────┘
85
87 attach(9E), detach(9E), prop_op(9E), ddi_create_minor_node(9F),
88 inquiry-vendor-id(9P)
89
90
91 Writing Device Drivers
92
93
94
95SunOS 5.11 23 Janl2008 size(9P)