Changeset 372df8f in mainline for uspace/srv/volsrv
- 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/srv/volsrv
- Files:
-
- 1 added
- 1 deleted
- 2 edited
- 2 moved
-
Makefile (modified) (1 diff)
-
disk.c (deleted)
-
part.c (added)
-
part.h (moved) (moved from uspace/srv/volsrv/disk.h ) (1 diff)
-
types/part.h (moved) (moved from uspace/srv/volsrv/types/disk.h ) (2 diffs)
-
volsrv.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/volsrv/Makefile
r0bde8523 r372df8f 31 31 32 32 SOURCES = \ 33 disk.c \33 part.c \ 34 34 volsrv.c 35 35 -
uspace/srv/volsrv/part.h
r0bde8523 r372df8f 35 35 */ 36 36 37 #ifndef DISK_H_38 #define DISK_H_37 #ifndef PART_H_ 38 #define pART_H_ 39 39 40 40 #include <sys/types.h> 41 41 #include <vol.h> 42 #include "types/ disk.h"42 #include "types/part.h" 43 43 44 extern int vol_disk_init(void); 45 extern int vol_disk_discovery_start(void); 46 extern int vol_disk_get_ids(service_id_t *, size_t, size_t *); 47 extern int vol_disk_find_by_id(service_id_t, vol_disk_t **); 48 extern int vol_disk_label_create(vol_disk_t *, label_type_t); 49 extern int vol_disk_empty_disk(vol_disk_t *); 50 extern int vol_disk_get_info(vol_disk_t *, vol_disk_info_t *); 44 extern int vol_part_init(void); 45 extern int vol_part_discovery_start(void); 46 extern int vol_part_get_ids(service_id_t *, size_t, size_t *); 47 extern int vol_part_find_by_id(service_id_t, vol_part_t **); 48 extern int vol_part_empty_part(vol_part_t *); 49 extern int vol_part_get_info(vol_part_t *, vol_part_info_t *); 51 50 52 51 #endif -
uspace/srv/volsrv/types/part.h
r0bde8523 r372df8f 35 35 */ 36 36 37 #ifndef TYPES_ DISK_H_38 #define TYPES_ DISK_H_37 #ifndef TYPES_PART_H_ 38 #define TYPES_PART_H_ 39 39 40 40 #include <types/label.h> 41 41 42 /** Disk*/42 /** Partition */ 43 43 typedef struct { 44 /** Link to vol_ disks */45 link_t l disks;44 /** Link to vol_parts */ 45 link_t lparts; 46 46 /** Service ID */ 47 47 service_id_t svc_id; … … 52 52 /** Label type */ 53 53 label_type_t ltype; 54 } vol_ disk_t;54 } vol_part_t; 55 55 56 56 #endif -
uspace/srv/volsrv/volsrv.c
r0bde8523 r372df8f 45 45 #include <vol.h> 46 46 47 #include " disk.h"47 #include "part.h" 48 48 49 49 #define NAME "volsrv" … … 56 56 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()"); 57 57 58 rc = vol_ disk_init();58 rc = vol_part_init(); 59 59 if (rc != EOK) 60 60 return rc; 61 61 62 rc = vol_ disk_discovery_start();62 rc = vol_part_discovery_start(); 63 63 if (rc != EOK) 64 64 return rc; … … 82 82 } 83 83 84 static void vol_get_ disks_srv(ipc_callid_t iid, ipc_call_t *icall)84 static void vol_get_parts_srv(ipc_callid_t iid, ipc_call_t *icall) 85 85 { 86 86 ipc_callid_t callid; … … 102 102 } 103 103 104 rc = vol_ disk_get_ids(id_buf, size, &act_size);104 rc = vol_part_get_ids(id_buf, size, &act_size); 105 105 if (rc != EOK) { 106 106 async_answer_0(callid, rc); … … 115 115 } 116 116 117 static void vol_ disk_info_srv(ipc_callid_t iid, ipc_call_t *icall)117 static void vol_part_info_srv(ipc_callid_t iid, ipc_call_t *icall) 118 118 { 119 119 service_id_t sid; 120 vol_ disk_t *disk;121 vol_ disk_info_t dinfo;120 vol_part_t *part; 121 vol_part_info_t pinfo; 122 122 int rc; 123 123 124 124 sid = IPC_GET_ARG1(*icall); 125 rc = vol_ disk_find_by_id(sid, &disk);125 rc = vol_part_find_by_id(sid, &part); 126 126 if (rc != EOK) { 127 127 async_answer_0(iid, ENOENT); … … 129 129 } 130 130 131 rc = vol_ disk_get_info(disk, &dinfo);131 rc = vol_part_get_info(part, &pinfo); 132 132 if (rc != EOK) { 133 133 async_answer_0(iid, EIO); … … 135 135 } 136 136 137 async_answer_3(iid, rc, dinfo.dcnt, dinfo.ltype, dinfo.flags);138 } 139 140 static void vol_ label_create_srv(ipc_callid_t iid, ipc_call_t *icall)137 async_answer_3(iid, rc, pinfo.dcnt, pinfo.ltype, pinfo.flags); 138 } 139 140 static void vol_part_empty_srv(ipc_callid_t iid, ipc_call_t *icall) 141 141 { 142 142 service_id_t sid; 143 vol_disk_t *disk; 144 label_type_t ltype; 143 vol_part_t *part; 145 144 int rc; 146 145 147 146 sid = IPC_GET_ARG1(*icall); 148 ltype = IPC_GET_ARG2(*icall); 149 150 rc = vol_disk_find_by_id(sid, &disk); 147 148 rc = vol_part_find_by_id(sid, &part); 151 149 if (rc != EOK) { 152 150 async_answer_0(iid, ENOENT); … … 154 152 } 155 153 156 rc = vol_disk_label_create(disk, ltype); 157 if (rc != EOK) { 158 async_answer_0(iid, EIO); 159 return; 160 } 161 162 async_answer_0(iid, EOK); 163 } 164 165 static void vol_disk_empty_srv(ipc_callid_t iid, ipc_call_t *icall) 166 { 167 service_id_t sid; 168 vol_disk_t *disk; 169 int rc; 170 171 sid = IPC_GET_ARG1(*icall); 172 173 rc = vol_disk_find_by_id(sid, &disk); 174 if (rc != EOK) { 175 async_answer_0(iid, ENOENT); 176 return; 177 } 178 179 rc = vol_disk_empty_disk(disk); 154 rc = vol_part_empty_part(part); 180 155 if (rc != EOK) { 181 156 async_answer_0(iid, EIO); … … 205 180 206 181 switch (method) { 207 case VOL_GET_ DISKS:208 vol_get_ disks_srv(callid, &call);182 case VOL_GET_PARTS: 183 vol_get_parts_srv(callid, &call); 209 184 break; 210 case VOL_ DISK_INFO:211 vol_ disk_info_srv(callid, &call);185 case VOL_PART_INFO: 186 vol_part_info_srv(callid, &call); 212 187 break; 213 case VOL_LABEL_CREATE: 214 vol_label_create_srv(callid, &call); 215 break; 216 case VOL_DISK_EMPTY: 217 vol_disk_empty_srv(callid, &call); 188 case VOL_PART_EMPTY: 189 vol_part_empty_srv(callid, &call); 218 190 break; 219 191 default:
Note:
See TracChangeset
for help on using the changeset viewer.
