nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
가상 파일 시스템 인터페이스

다양한 종류의 파일시스템을 지원하기 위한 인터페이스 계층을 정의하고 구현한다. VFS 는 폴더와 파일의 계층 구조를 Binary tree 형태로 표현하고, 유지 관리한다. 다양한 종류의 파일 시스템들은 주어진 sinfo 구조체에 맞추어 함수를 구현한다. VFS 는 On-demand 형태로 tree 를 구축해 나간다. 즉, 실제 특정 폴더에 접근을 할 때, 해당 폴더의 자식 node 를 생성한다. 자식 노드들을 채우는 것은 파일시스템에서 구현한다. More...

Data Structures

struct  entry
 ninfo 에 대한 context 정보를 정의 한다. More...
 
struct  nctx
 파일에 접근하는 과정의 콘텍스트 정보를 유지/관리 한다. More...
 
struct  ninfo
 Node information 를 정의한다. More...
 
struct  ninfo_dev
 장치 정보 More...
 
struct  ninfo_ops
 해당 ninfo 에 대한 operation 함수 포인터 More...
 
struct  sinfo
 

Macros

#define MAJOR(id)   ((id) >> 8)
 Device 의 종류 More...
 
#define MINOR(id)   ((id) & 0xFF)
 Sub device 종류 More...
 
#define ROOT_NINFO   0
 

Enumerations

enum  ntype { NINFO_TYPE_UNKNOWN, NINFO_TYPE_FOLDER, NINFO_TYPE_FILE, NINFO_TYPE_DEVICE }
 Node type 을 정의한다. More...
 

Functions

int vfs_attach_storage (struct ninfo *node, struct sinfo *sb)
 저장 장치를 특정 노드와 연결시킨다. More...
 
int vfs_deatch_storage (struct ninfo *node)
 저장 장치를 특정 노드와의 연결을 끊는다. More...
 
int vfs_del_ninfo (struct ninfo *ninfo)
 주어진 노드를 삭제한다. 이 때, 자식 노드들이 있으면 모두 함께 삭제 More...
 
struct sinfovfs_get_last_sinfo (struct ninfo *node)
 주어진 노드에 가장 최근에 연결된 저장 장치 정보를 가져온다. More...
 
struct ninfovfs_get_ninfo (struct sinfo *sinfo, struct ninfo *node, const char *path)
 주어진 노드를 기준으로, 경로에 해당하는 노드 정보를 가져온다. More...
 
struct ninfovfs_get_ninfo_child (struct ninfo *node)
 자식 노드를 가져온다. More...
 
struct ninfovfs_get_ninfo_next_sibling (struct ninfo *node)
 다음 형제 노드를 가져온다. More...
 
struct ninfovfs_get_ninfo_parent (struct ninfo *node)
 부모 노드를 가져온다. 현재 노드가 root 노드와 같다면 NULL 반환 More...
 
struct ninfovfs_get_ninfo_prev_sibling (struct ninfo *node)
 이전 형제 노드를 가져온다. More...
 
int vfs_init (void)
 VFS 를 초기화 한다. More...
 
struct ninfovfs_new_dev_ninfo (struct sinfo *si, struct ninfo *parent, const char *name, dev_t device, struct ninfo_ops *nops)
 
struct ninfovfs_new_ninfo (struct sinfo *si, struct ninfo *parent, const char *name, void *info)
 주어진 경로에 해당하는 노드를 새로 만든다. More...
 

Detailed Description

다양한 종류의 파일시스템을 지원하기 위한 인터페이스 계층을 정의하고 구현한다. VFS 는 폴더와 파일의 계층 구조를 Binary tree 형태로 표현하고, 유지 관리한다. 다양한 종류의 파일 시스템들은 주어진 sinfo 구조체에 맞추어 함수를 구현한다. VFS 는 On-demand 형태로 tree 를 구축해 나간다. 즉, 실제 특정 폴더에 접근을 할 때, 해당 폴더의 자식 node 를 생성한다. 자식 노드들을 채우는 것은 파일시스템에서 구현한다.

Date
2011.8.21
Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com

Macro Definition Documentation

#define MAJOR (   id)    ((id) >> 8)

Device 의 종류

Definition at line 45 of file vfs.h.

#define MINOR (   id)    ((id) & 0xFF)

Sub device 종류

Definition at line 48 of file vfs.h.

Referenced by fdc_open(), serial_close(), and serial_open().

#define ROOT_NINFO   0

Definition at line 91 of file vfs.h.

Referenced by vfs_del_ninfo(), vfs_get_ninfo(), vfs_get_ninfo_child(), and vfs_get_ninfo_parent().

Enumeration Type Documentation

enum ntype

Node type 을 정의한다.

Enumerator
NINFO_TYPE_UNKNOWN 

미정

NINFO_TYPE_FOLDER 

폴더

NINFO_TYPE_FILE 

파일

NINFO_TYPE_DEVICE 

장치 파일

Definition at line 25 of file vfs.h.

Function Documentation

int vfs_attach_storage ( struct ninfo node,
struct sinfo sb 
)

저장 장치를 특정 노드와 연결시킨다.

Parameters
[in]node
[in]sb
Returns
int 성공시 0, 실패시 에러코드

Definition at line 62 of file vfs.c.

References sinfo::head, and ninfo::sinfo.

int vfs_deatch_storage ( struct ninfo node)

저장 장치를 특정 노드와의 연결을 끊는다.

Parameters
[in]node
Returns
int 성공시 0, 실패시 에러코드
int vfs_del_ninfo ( struct ninfo ninfo)

주어진 노드를 삭제한다. 이 때, 자식 노드들이 있으면 모두 함께 삭제

Parameters
[in]ninfo삭제할 노드
Returns
int 성공시 0, 실패시 에러코드
Note
The tmp node is not able to be deleted
Escape condition

Definition at line 93 of file vfs.c.

References ninfo::child, EINVAL, ENOMEM, free(), sinfo::get_ninfo, ninfo::head_sibling, list_entry, list_for_each_safe, LIST_HEAD, malloc(), NULL, ROOT_NINFO, ninfo::si, vfs_get_ninfo_child(), vfs_get_ninfo_next_sibling(), and vfs_get_ninfo_parent().

Referenced by fat_load().

Here is the call graph for this function:

Here is the caller graph for this function:

struct sinfo* vfs_get_last_sinfo ( struct ninfo node)

주어진 노드에 가장 최근에 연결된 저장 장치 정보를 가져온다.

Parameters
[in]node연결될 저장 장치 정보를 가져올 노드
Returns
struct sinfo* 저장 장치 정보, 없으면 NULL

Definition at line 487 of file vfs.c.

References sinfo::head, list_entry, NINFO_TYPE_FOLDER, NULL, list_head::prev, ninfo::sinfo, and ninfo::type.

struct ninfo* vfs_get_ninfo ( struct sinfo sinfo,
struct ninfo node,
const char *  path 
)

주어진 노드를 기준으로, 경로에 해당하는 노드 정보를 가져온다.

Parameters
[in]sinfo저장 장치 정보
[in]node노드 정보
[in]path경로
Returns
struct ninfo* 노드 포인터

Definition at line 206 of file vfs.c.

References sinfo::get_ninfo, list_entry, list_for_each, ninfo::name, NULL, ROOT_NINFO, ninfo::sibling, strncmp(), vfs_get_ninfo_child(), and vfs_get_ninfo_parent().

Referenced by fdc_init(), keyboard_init(), serial_init(), and video_init().

Here is the call graph for this function:

Here is the caller graph for this function:

struct ninfo* vfs_get_ninfo_child ( struct ninfo node)

자식 노드를 가져온다.

Parameters
[in]node부모노드
Returns
struct ninfo* 현재 노드가 폴더가 아니거나, 자식이 없다면 NULL

Definition at line 408 of file vfs.c.

References ninfo::child, sinfo::get_ninfo, ninfo::head_sibling, list_entry, list_head::next, NINFO_TYPE_FOLDER, NULL, sinfo::refresh_children, ROOT_NINFO, ninfo::si, and ninfo::type.

Referenced by vfs_del_ninfo(), vfs_get_ninfo(), vfs_new_dev_ninfo(), and vfs_new_ninfo().

Here is the caller graph for this function:

struct ninfo* vfs_get_ninfo_next_sibling ( struct ninfo node)

다음 형제 노드를 가져온다.

Parameters
[in]node현재 노드
Returns
struct ninfo* 형제 노드
See Also
vfs_get_ninfo_prev()

Definition at line 459 of file vfs.c.

References ninfo::head_sibling, list_entry, list_head::next, NULL, and ninfo::sibling.

Referenced by vfs_del_ninfo().

Here is the caller graph for this function:

struct ninfo* vfs_get_ninfo_parent ( struct ninfo node)

부모 노드를 가져온다. 현재 노드가 root 노드와 같다면 NULL 반환

Parameters
[in]node부모 노드를 가져올 노드
Returns
struct ninfo* 현재 노드가 root 이면 NULL, 아니면 부모 노드

Definition at line 439 of file vfs.c.

References ninfo::child, sinfo::get_ninfo, list_entry, NULL, list_head::prev, ROOT_NINFO, and ninfo::si.

Referenced by vfs_del_ninfo(), and vfs_get_ninfo().

Here is the caller graph for this function:

struct ninfo* vfs_get_ninfo_prev_sibling ( struct ninfo node)

이전 형제 노드를 가져온다.

Parameters
[in]node현재 노드
Returns
struct ninfo* 형제 노드
See Also
vfs_get_ninfo_next()

Definition at line 471 of file vfs.c.

References ninfo::head_sibling, list_entry, NULL, list_head::prev, and ninfo::sibling.

int vfs_init ( void  )

VFS 를 초기화 한다.

Returns
int 성공시 0, 실패시 에러코드
Note
Initialize the s_root
루트 노드는 반드시 0이어야 한다. 노드를 브라우징 하는 과정에서 child 목록에 링크가 된 노드임에도 head_sibiling 이 0이면, root 노드로 간주하기 때문이다. 알고리즘을 개선할 필요가 있다.

Definition at line 21 of file vfs.c.

References ninfo::child, ninfo_ops::close, sinfo::del_ninfo, ninfo::deleted, sinfo::fill_ninfo, sinfo::get_ninfo, sinfo::head, ninfo::head_sibling, ninfo::id, ninfo_ops::ioctl, ninfo_ops::lseek, NINFO_TYPE_FOLDER, ninfo::nops, NULL, ninfo_ops::open, ninfo::priv, sinfo::priv, ninfo_ops::read, ninfo::refcnt, sinfo::refcnt, sinfo::refresh_children, ninfo::si, ninfo::sibling, ninfo::sinfo, ninfo::size, ninfo::type, and ninfo_ops::write.

struct ninfo* vfs_new_dev_ninfo ( struct sinfo si,
struct ninfo parent,
const char *  name,
dev_t  device,
struct ninfo_ops nops 
)

Definition at line 500 of file vfs.c.

References ninfo::child, ninfo::deleted, ninfo_dev::device, free(), ninfo::head_sibling, malloc(), ninfo::name, NINFO_TYPE_DEVICE, NINFO_TYPE_FOLDER, ninfo::nops, NULL, ninfo::priv, ninfo::refcnt, ninfo::si, ninfo::sibling, ninfo::sinfo, strdup(), ninfo::type, and vfs_get_ninfo_child().

Referenced by fdc_init(), keyboard_init(), serial_init(), and video_init().

Here is the call graph for this function:

Here is the caller graph for this function:

struct ninfo* vfs_new_ninfo ( struct sinfo si,
struct ninfo parent,
const char *  name,
void *  info 
)

주어진 경로에 해당하는 노드를 새로 만든다.

Parameters
[in]si저장 장치 정보
[in]parent부모 노드
[in]name노드의 이름
[in]info노드의 고유 정보
Returns
struct ninfo* 성공시 생성된 노드 포인터

Definition at line 339 of file vfs.c.

References ninfo::child, ninfo::deleted, sinfo::fill_ninfo, free(), ninfo::head_sibling, malloc(), ninfo::name, NINFO_TYPE_FOLDER, NULL, ninfo::priv, ninfo::refcnt, ninfo::si, ninfo::sibling, ninfo::sinfo, strdup(), ninfo::type, and vfs_get_ninfo_child().

Referenced by fat_load(), and load_rootfs().

Here is the call graph for this function:

Here is the caller graph for this function: