Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

IBM AIX device driver development

A tutorial on AIX device driver framework and related APIs

Gautam Raut (gautraut@in.ibm.com), Senior Software Engineer, IBM
Gautam
Gautam Raut works as a Senior Software Engineer for the Andrew File System (AFS) Team at the IBM Software Labs in Pune, India. He works with kernel and user-level debugging of dumps and crashes, as well as reported bugs on the Linux and AIX platforms. He has also worked on various AFS-specific AIX kernel components. Gautam holds M.S. in Computer Science from the University of Pune. He is a Linux enthusiast who spends his spare time exploring the Linux kernel on his Fedora 8 box.

Summary:  This tutorial illustrates the IBM® AIX® device driver framework and related application programming interfaces (APIs). Here, we shall discuss about the device switch structure, API to register device switch methods, major and minor number management, and moving data from kernel to user space.

Date:  28 Mar 2013
Level:  Intermediate PDF:  A4 and Letter (244 KB | 15 pages)Get Adobe® Reader®

Activity:  20933 views
Comments:  

Components and significance of the uio structure

The uio structure contains a memory buffer used for exchange of data between user and kernel space while implementing driver routines. The uio structure describes a buffer that is not contiguous in virtual memory. The ureadc, uwritec, uiomove, and uphysio kernel services all perform data transfers into or out of a data buffer described by the uio structure. The uio structure is defined in /usr/include/sys/uio.h file.

struct uio {
/* ptr to array of iovec structs describing  user buffer for data transfer */
   struct  iovec *uio_iov;
/* ptr to array of xmem structs containing cross memory descriptors for iovec array.*/	
   struct  xmem  *uio_xmem;
/* #iovec elements remaining to be processed*/
   int32long64_t  uio_iovcnt;

/* #iovec elements already processed */
   int32long64_t  uio_iovdcnt;
#ifdef _LONG_LONG
/* byte offset in file/dev to read/write */
   offset_t uio_offset;    
#else /* _LONG_LONG */
#ifdef __64BIT__
/* off_t offset for ANSI-C mode */
   off_t   uio_offset;     
#else
/* ANSI-C does not support long long */
   int     uio_rsvd;
/* off_t offset for ANSI-C mode      */       
   off_t   uio_offset;     
#endif /* __64BIT__ */
#endif  /* _LONG_LONG */
/* Byte count for data transfer  */
   int32long64_t uio_resid;                
/* Type of buffer being described by uio structure. Data pointed by 
  buffer can either be in user or kernel or cross-memory region. */
   short   uio_segflg;
/* copy of file modes from open file structure */    
   long    uio_fmode;      
};

9 of 15 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX, Linux
ArticleID=861832
TutorialTitle= IBM AIX device driver development
publish-date=03282013
author1-email=gautraut@in.ibm.com
author1-email-cc=