Subversion Repositories HelenOS

Rev

Rev 3424 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3424 Rev 4377
Line 53... Line 53...
53
#define NAME "tmpfs"
53
#define NAME "tmpfs"
54
 
54
 
55
 
55
 
56
vfs_info_t tmpfs_vfs_info = {
56
vfs_info_t tmpfs_vfs_info = {
57
    .name = "tmpfs",
57
    .name = "tmpfs",
58
    .ops = {
-
 
59
        [IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] = VFS_OP_DEFINED,
-
 
60
        [IPC_METHOD_TO_VFS_OP(VFS_READ)] = VFS_OP_DEFINED,
-
 
61
        [IPC_METHOD_TO_VFS_OP(VFS_WRITE)] = VFS_OP_DEFINED,
-
 
62
        [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_DEFINED,
-
 
63
        [IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_DEFINED,
-
 
64
        [IPC_METHOD_TO_VFS_OP(VFS_MOUNTED)] = VFS_OP_DEFINED,
-
 
65
        [IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL,
-
 
66
        [IPC_METHOD_TO_VFS_OP(VFS_DESTROY)] = VFS_OP_DEFINED,
-
 
67
    }
-
 
68
};
58
};
69
 
59
 
70
fs_reg_t tmpfs_reg;
60
fs_reg_t tmpfs_reg;
71
 
61
 
72
/**
62
/**
Line 134... Line 124...
134
    }
124
    }
135
}
125
}
136
 
126
 
137
int main(int argc, char **argv)
127
int main(int argc, char **argv)
138
{
128
{
139
    int vfs_phone;
-
 
140
 
-
 
141
    printf(NAME ": HelenOS TMPFS file system server\n");
129
    printf(NAME ": HelenOS TMPFS file system server\n");
142
 
130
 
-
 
131
    if (!tmpfs_init()) {
-
 
132
        printf(NAME ": failed to initialize TMPFS\n");
-
 
133
        return -1;
-
 
134
    }
-
 
135
 
143
    vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0);
136
    int vfs_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VFS, 0, 0);
144
    while (vfs_phone < EOK) {
137
    if (vfs_phone < EOK) {
-
 
138
        printf(NAME ": Unable to connect to VFS\n");
145
        usleep(10000);
139
        return -1;
146
        vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0);
-
 
147
    }
140
    }
148
   
141
   
149
    int rc;
-
 
150
    rc = fs_register(vfs_phone, &tmpfs_reg, &tmpfs_vfs_info,
142
    int rc = fs_register(vfs_phone, &tmpfs_reg, &tmpfs_vfs_info,
151
        tmpfs_connection);
143
        tmpfs_connection);
152
    if (rc != EOK) {
144
    if (rc != EOK) {
153
        printf(NAME ": Failed to register file system (%d)\n", rc);
145
        printf(NAME ": Failed to register file system (%d)\n", rc);
154
        return rc;
146
        return rc;
155
    }
147
    }