RF-IDs in the Kernel -- Episode III: I want to File Away

Similar documents
Virtual File System (VFS) Implementation in Linux. Tushar B. Kute,

CS5460/6460: Operating Systems. Lecture 24: Device drivers. Anton Burtsev April, 2014

CS 378 (Spring 2003)

CS444 3/08/05. Linux Virtual File System

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Disk and File System

Unix (Linux) Device Drivers

PFStat. Global notes

CS 140 Project 4 File Systems Review Session

Operating System Concepts Ch. 11: File System Implementation

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

Virtual File System. Don Porter CSE 306

Linux Loadable Kernel Modules (LKM)

Finish up OS topics Group plans

CS 378 (Spring 2003)

Designing and developing device drivers. Coding drivers

Status of the Linux NFS client

NPTEL Course Jan K. Gopinath Indian Institute of Science

CS 423 Operating System Design: Introduction to Linux Kernel Programming (MP1 Q&A)

1 / 22. CS 135: File Systems. General Filesystem Design

Idea of Metadata Writeback Cache for Lustre

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

VFS, Continued. Don Porter CSE 506

Input & Output 1: File systems

CSE 333 SECTION 3. POSIX I/O Functions

we are here I/O & Storage Layers Recall: C Low level I/O Recall: C Low Level Operations CS162 Operating Systems and Systems Programming Lecture 18

RCU. ò Dozens of supported file systems. ò Independent layer from backing storage. ò And, of course, networked file system support

CS 453: Operating Systems Programming Project 5 (100 points) Linux Device Driver

Virtual File System. Don Porter CSE 506

we are here Page 1 Recall: How do we Hide I/O Latency? I/O & Storage Layers Recall: C Low level I/O

Introduction to Linux Device Drivers Recreating Life One Driver At a Time

Outline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems

Systems Programming. 09. Filesystem in USErspace (FUSE) Alexander Holupirek

Pintos Project 4 File Systems. November 14, 2016

Linux Device Drivers. 3. Char Drivers. 1. Introduction 2. Kernel Modules 3. Char Drivers 4. Advanced Char Drivers 5. Interrupts

CS Lab 2: fs. Vedant Kumar, Palmer Dabbelt. February 27, Getting Started 2

Tricky issues in file systems

Using persistent memory to

NPTEL Course Jan K. Gopinath Indian Institute of Science

Character Device Drivers

DMA safety in buffers for Linux Kernel device drivers

Final Step #7. Memory mapping For Sunday 15/05 23h59

Operating System Labs. Yuanbin Wu

1 / 23. CS 137: File Systems. General Filesystem Design

Introduction Reading Writing scull. Linux Device Drivers - char driver

File Management 1/34

Applying User-level Drivers on

File Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

ECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University

Files and the Filesystems. Linux Files

FAME Operatinf Systems - Modules

Homework # 7 DUE: 11:59pm November 15, 2002 NO EXTENSIONS WILL BE GIVEN

Linux Device Drivers Interrupt Requests

Lecture 11: Linux ext3 crash recovery

CSE 333 SECTION 3. POSIX I/O Functions

W4118 Operating Systems. Instructor: Junfeng Yang

An efficient method to avoid path lookup in file access auditing in IO path to improve file system IO performance

File Systems. COMS W4118 Prof. Kaustubh R. Joshi hcp://

The EXT2FS Library. The EXT2FS Library Version 1.37 January by Theodore Ts o

This lecture is covered in Section 4.1 of the textbook.

File Systems: Naming

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

ExecVus. Alexandru Totolici

Filesystems timing attacks

CSE506: Operating Systems CSE 506: Operating Systems

Important Dates. October 27 th Homework 2 Due. October 29 th Midterm

ECE 598 Advanced Operating Systems Lecture 17

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Working with Basic Linux. Daniel Balagué

To understand this, let's build a layered model from the bottom up. Layers include: device driver filesystem file

Fuse Extension. version Erick Gallesio Université de Nice - Sophia Antipolis 930 route des Colles, BP 145 F Sophia Antipolis, Cedex France

Applications of. Virtual Memory in. OS Design

CHANDLER CARRUTH LLVM DEVMTG 2014 THE LLVM PASS MANAGER PART 2

File System Implementation

Files. Eric McCreath

DESERT CODE CAMP

Virtual File System. Changwoo Min

Tutorial 2. Linux networking, sk_buff and stateless packet filtering. Roei Ben-Harush Check Point Software Technologies Ltd.

Project 5: GeekOS File System 2

Device Drivers. CS449 Fall 2017

ECE 598 Advanced Operating Systems Lecture 18

CSE506: Operating Systems CSE 506: Operating Systems

The UNIX File System

Operating Systems (234123) Spring 2017 (Homework Wet 1) Homework 1 Wet

Filename encoding. and case-insensitive filesystems. Gabriel Krisman Bertazi

CS240: Programming in C

CSE 451: Operating Systems. Sec$on 8 Project 2b wrap- up, ext2, and Project 3

ECE 598 Advanced Operating Systems Lecture 19

Engineering Robust Server Software

QUIZ. What is wrong with this code that uses default arguments?

AC72/AT72/AC117/AT117 LINUX INTERNALS DEC 2015

7.4 Simple example of Linux drivers

Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement

Virtual Machine Introspection Bhushan Jain

CSL373/CSL633 Major Exam Solutions Operating Systems Sem II, May 6, 2013 Answer all 8 questions Max. Marks: 56

Chapter 4. File Systems. Part 1

Caching and reliability

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC

Implementation of a Tag-Based File System

Owning the Network: Adventures in Router Rootkits

A heap, a stack, a bottle and a rack. Johan Montelius HT2017

Transcription:

What s on the menu Software Comprehension and Maintenance June 2005 RF-IDs in the Kernel -- Episode III: I want to File Away Achilleas Anagnostopoulos (archie@istlab.dmst.aueb.gr) Department of Management Science and Technology Athens University Of Economics and Business

Flashback: What we are trying to accomplish Low level access to readers Event collector/dispatcher We need a unified way for reading and writing RF-ID tags from our own applications. Linux Virtual File System Applications Linux Kernel The proposed solution involves a specialized kernel module for linux to service this need.

The Roadmap or Where are we now? Initial Concept Plan of attack Select the best way to implement the module Define Interface for talking to applications Define Interface for talking to transponders We are here Write and Test the module Submit the module for evaluation

File Systems in Linux: The boring technical stuff (I) The notion of the i-node A structure describing an entity in the filesystem and containing all its attributes (size,owner,timestamps ) The kernel provides hooks which the filesystem uses to map files and folders to i-nodes, create, move(rename) and delete files. When the kernel runs our module for the first time we supply a list with all the filesystem functions implemented by our module. Kernel init Our RFID-fs module Kernel functions Example: If the kernel wants to look up a file in our filesystem: Lookup Kernel Rfid_fs_lookup( ); Kernel result

File Systems in Linux: The boring technical stuff (II) Just how many hook-able functions are there? MANY void (*read_inode) (struct inode *); void (*write_inode) (struct inode *, int); void (*put_inode) (struct inode *); void (*delete_inode) (struct inode *); void (*put_super) (struct super_block *); void (*write_super) (struct super_block *); int (*statfs) (struct super_block *, struct statfs *); int (*remount_fs) (struct super_block *, int *, char *); void (*clear_inode) (struct inode *); void (*umount_begin) (struct super_block *); ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char *, size_t, loff_t *); ssize_t (*write) (struct file *, const char *, size_t, loff_t *); int (*readdir) (struct file *, void *, filldir_t); unsigned int (*poll) (struct file *, struct poll_table_struct *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); int (*mmap) (struct file *, struct vm_area_struct *); int (*open) (struct inode *, struct file *); int (*flush) (struct file *); int (*release) (struct inode *, struct file *); int (*fsync) (struct file *, struct dentry *, int datasync); int (*fasync) (int, struct file *, int);. Do I need to write ALL those functions myself? Eeek!!! Nope! You just have to supply the functions you need to use. If you are the kind of lazy programmer (like I am ) you should consider yourself lucky! The kernel writers even provide you with generic functions to do most of the boring filesystem chores. You can actually write an FS in about 245 LOC! (ramfs)

RFID-fs: How is it organized file_data tag_data tag_list char *name int name_len void *data int data_len long data_hash tag_data *item char type inode* my_inode bool is_dirty reader *my_reader tag_list *next tag_list *prev file_list inode_data reader reader_list file_data *item tag_data *my_tag Inode *my_inode tag_list *my_tags reader *item file_list *next file_list *prev file_data *my_file file_list *children reader_callbacks void *reader_data reader_list *next reader_list *prev

Speaking of Files and Folders In RFID-fs there are three types of objects. Tag Files : They represent RFID-tags. You can read them. like ordinary files and depending on the transponder h/w, also write them. Reader Dirs : These are automatically allocated by the module when a reader module is enabled. Inside them you can find all tags in the reader s range. However, you cannot copy, rename, move or delete them. User Dirs : These are directories the user may create for organizing his tags. You can do pretty much whatever you want with these folders.

The Problem: Detecting RFID-tags in the reader s range. How can we detect which tags are currently in the reader s range? Remember that if a tag cannot be read anymore, it has to be removed from the filesystem as well. The current solution involves polling readers at fixed intervals. Readers are generally slow. Most are in the 10-100 tags/sec range. So, polling isn t really a bad solution! We use the kernel timer mechanism for polling hw every 600-700 ms. Before polling, we flag all tags as dirty. Once a tag is read, we clear its dirty flag. Any tags remaining dirty are automatically removed.

Some final tips regarding kernel hacking Google is your best friend! Use the source, Luke! There are a lot of e-books out there describing the ins and outs of the linux kernel and its API When everything else fails, use a hammer The END - Any Questions? The complete source code of the rfid-fs module will be soon available online