Changeset 372df8f in mainline for uspace/lib/c
- Timestamp:
- 2015-10-09T07:00:23Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ecfc62
- Parents:
- 0bde8523
- Location:
- uspace/lib/c
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vbd.c
r0bde8523 r372df8f 43 43 #include <vbd.h> 44 44 45 static int vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **, 46 size_t *); 47 45 48 int vbd_create(vbd_t **rvbd) 46 49 { … … 85 88 } 86 89 87 int vbd_disk_add(vbd_t *vbd, service_id_t disk_sid) 88 { 89 async_exch_t *exch; 90 91 exch = async_exchange_begin(vbd->sess); 92 sysarg_t rc = async_req_1_0(exch, VBD_DISK_ADD, disk_sid); 93 async_exchange_end(exch); 94 95 return (int)rc; 96 } 97 98 int vbd_disk_remove(vbd_t *vbd, service_id_t disk_sid) 99 { 100 async_exch_t *exch; 101 102 exch = async_exchange_begin(vbd->sess); 103 sysarg_t rc = async_req_1_0(exch, VBD_DISK_REMOVE, disk_sid); 104 async_exchange_end(exch); 105 106 return (int)rc; 90 /** Get list of partitions as array of service IDs. 91 * 92 * @param vbd Virtual block device service 93 * @param data Place to store pointer to array 94 * @param count Place to store length of array (number of entries) 95 * 96 * @return EOK on success or negative error code 97 */ 98 int vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count) 99 { 100 return vbd_get_ids_internal(vbd, VBD_GET_DISKS, 0, data, count); 107 101 } 108 102 -
uspace/lib/c/generic/vol.c
r0bde8523 r372df8f 175 175 } 176 176 177 /** Get list of disks as array of service IDs.177 /** Get list of partitions as array of service IDs. 178 178 * 179 179 * @param vol Volume service … … 183 183 * @return EOK on success or negative error code 184 184 */ 185 int vol_get_ disks(vol_t *vol, service_id_t **data, size_t *count)186 { 187 return vol_get_ids_internal(vol, VOL_GET_ DISKS, 0, data, count);188 } 189 190 /** Get diskinformation. */191 int vol_ disk_info(vol_t *vol, service_id_t sid, vol_disk_info_t *vinfo)185 int vol_get_parts(vol_t *vol, service_id_t **data, size_t *count) 186 { 187 return vol_get_ids_internal(vol, VOL_GET_PARTS, 0, data, count); 188 } 189 190 /** Get partition information. */ 191 int vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo) 192 192 { 193 193 async_exch_t *exch; … … 196 196 197 197 exch = async_exchange_begin(vol->sess); 198 retval = async_req_1_3(exch, VOL_ DISK_INFO, sid, &dcnt, <ype,198 retval = async_req_1_3(exch, VOL_PART_INFO, sid, &dcnt, <ype, 199 199 &flags); 200 200 async_exchange_end(exch); … … 209 209 } 210 210 211 /** Create new label. */ 212 int vol_label_create(vol_t *vol, service_id_t sid, label_type_t ltype) 211 /** Erase partition (to the extent where we will consider it not containing 212 * a file system. */ 213 int vol_part_empty(vol_t *vol, service_id_t sid) 213 214 { 214 215 async_exch_t *exch; … … 216 217 217 218 exch = async_exchange_begin(vol->sess); 218 retval = async_req_ 2_0(exch, VOL_LABEL_CREATE, sid, ltype);219 retval = async_req_1_0(exch, VOL_PART_EMPTY, sid); 219 220 async_exchange_end(exch); 220 221 … … 225 226 } 226 227 227 /** Erase disk (to the extent where we will consider it not containing228 * a label or file system. */229 int vol_disk_empty(vol_t *vol, service_id_t sid)230 {231 async_exch_t *exch;232 int retval;233 234 exch = async_exchange_begin(vol->sess);235 retval = async_req_1_0(exch, VOL_DISK_EMPTY, sid);236 async_exchange_end(exch);237 238 if (retval != EOK)239 return EIO;240 241 return EOK;242 }243 244 228 /** @} 245 229 */ -
uspace/lib/c/include/ipc/vbd.h
r0bde8523 r372df8f 37 37 38 38 typedef enum { 39 VBD_DISK_ADD = IPC_FIRST_USER_METHOD, 40 VBD_DISK_REMOVE, 39 VBD_GET_DISKS = IPC_FIRST_USER_METHOD, 41 40 VBD_DISK_INFO, 42 41 VBD_LABEL_CREATE, -
uspace/lib/c/include/ipc/vol.h
r0bde8523 r372df8f 37 37 38 38 typedef enum { 39 VOL_GET_DISKS = IPC_FIRST_USER_METHOD, 40 VOL_DISK_INFO, 41 VOL_LABEL_CREATE, 42 VOL_DISK_EMPTY 39 VOL_GET_PARTS = IPC_FIRST_USER_METHOD, 40 VOL_PART_INFO, 41 VOL_PART_EMPTY 43 42 } vol_request_t; 44 43 -
uspace/lib/c/include/types/label.h
r0bde8523 r372df8f 52 52 /** Disk label type */ 53 53 typedef enum { 54 /** No label */ 55 lt_none, 54 56 /** BIOS Master Boot Record */ 55 57 lt_mbr, … … 58 60 } label_type_t; 59 61 62 #define LT_FIRST (lt_mbr) 60 63 #define LT_LIMIT (lt_gpt + 1) 61 64 -
uspace/lib/c/include/vbd.h
r0bde8523 r372df8f 93 93 extern int vbd_create(vbd_t **); 94 94 extern void vbd_destroy(vbd_t *); 95 extern int vbd_disk_add(vbd_t *, service_id_t); 96 extern int vbd_disk_remove(vbd_t *, service_id_t); 95 extern int vbd_get_disks(vbd_t *, service_id_t **, size_t *); 97 96 extern int vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *); 98 97 extern int vbd_label_create(vbd_t *, service_id_t, label_type_t); -
uspace/lib/c/include/vol.h
r0bde8523 r372df8f 47 47 } vol_t; 48 48 49 /** Diskinformation */49 /** Partition information */ 50 50 typedef struct { 51 /** Diskcontents */51 /** Partition contents */ 52 52 label_disk_cnt_t dcnt; 53 /** Label type, if disk contents is label*/53 /** Label type, if partition contents is label XXX */ 54 54 label_type_t ltype; 55 55 /** Label flags */ 56 56 label_flags_t flags; 57 } vol_ disk_info_t;57 } vol_part_info_t; 58 58 59 59 extern int vol_create(vol_t **); 60 60 extern void vol_destroy(vol_t *); 61 extern int vol_get_disks(vol_t *, service_id_t **, size_t *); 62 extern int vol_disk_info(vol_t *, service_id_t, vol_disk_info_t *); 63 extern int vol_label_create(vol_t *, service_id_t, label_type_t); 64 extern int vol_disk_empty(vol_t *, service_id_t); 61 extern int vol_get_parts(vol_t *, service_id_t **, size_t *); 62 extern int vol_part_info(vol_t *, service_id_t, vol_part_info_t *); 63 extern int vol_part_empty(vol_t *, service_id_t); 65 64 66 65 #endif
Note:
See TracChangeset
for help on using the changeset viewer.